Skip to content

Conversation

JelleZijlstra
Copy link
Member

@JelleZijlstra JelleZijlstra commented May 4, 2025

Closes #82129. Closes #122262.

This is on top of @sobolevn's #122262 but jumps through a few more hoops to achieve these goals:

  • The annotations on dataclasses with make_dataclass() are sensible in all formats
  • We don't import typing until we really have to

try:
ann = _get_dunder_annotations(obj)
except NameError:
except Exception:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a separate PR (with tests) for this change in #133407.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for reviving this PR! It looks like it achieves its main goal.

@JelleZijlstra JelleZijlstra marked this pull request as ready for review May 4, 2025 22:59
@JelleZijlstra JelleZijlstra requested a review from ericvsmith as a code owner May 4, 2025 22:59
@JelleZijlstra JelleZijlstra requested a review from sobolevn May 4, 2025 23:26
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JelleZijlstra JelleZijlstra merged commit bb5ec6e into python:main May 5, 2025
45 checks passed
@JelleZijlstra JelleZijlstra deleted the gh18219-alt branch May 5, 2025 15:21
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

get_type_hints fails if there are un-annotated fields in a dataclass

2 participants